/**
 * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
 */
package com.jeeplus.modules.web.mapper;

import java.util.Date;
import java.util.List;

import com.jeeplus.modules.web.entity.YjLog;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

import com.jeeplus.core.persistence.BaseMapper;
import com.jeeplus.core.persistence.annotation.MyBatisMapper;
import com.jeeplus.modules.web.entity.WxAgents;
import com.jeeplus.modules.web.entity.YjAgentsDistribution;
import com.jeeplus.modules.web.entity.YjEquipment;

/**
 * 设备信息MAPPER接口
 *
 * @author rongjie
 * @version 2017-08-06
 */
@MyBatisMapper
public interface YjEquipmentMapper extends BaseMapper<YjEquipment> {

	Integer setTotal(@Param("mac") String mac, @Param("orderTime") Integer orderTime,@Param("startTime")Date startTime,@Param("endTime")Date endTime,@Param("orders")String orders);

	Integer addRecording(@Param("orderNumber") String orderNumber, @Param("mac") String mac,
			@Param("orderTime") Integer orderTime);

	WxAgents getAgents(String mac);

	Integer setAgents(@Param("money") Double money, @Param("number") String number, @Param("id") String id);

	List<YjAgentsDistribution> getYjAgentsDistributionList();

	int setDistribution(@Param("id") String id, @Param("a") String a);

	int setYjAgentsDistribution(@Param("id") String id, @Param("b") String b, @Param("c") String c,
			@Param("time") Date time);

	@Update("update yj_equipment set type=#{type} where number=#{mac}  ")
	int setStop(@Param("mac") String mac, @Param("type") Integer type);

	@Update("update yj_equipment set light_status=#{lightStatus} where number=#{mac}  ")
	int setLightStatus(@Param("mac") String mac, @Param("lightStatus") Integer lightStatus);

	@Update("update  yj_command set type=1 where equipment=#{mac} and type=0   ")
	int setType(String mac);

	@Update("select count(id) from   yj_equipment where type=0 and number=#{mac}    ")
	int getOnLineEquipment(String mac);

	@Update("update  yj_command set type=1 where order_number=#{orderNumber} and type=0   ")
	int setTypeByOrderNumber(String orderNumber);

	int updateMaintenance(@Param("number") String number, @Param("maintenance") Integer maintenance);

	int saveLog(YjLog yjLog);

}
